package com.glebusheg.data
{
	import com.glebusheg.text.StringManager;
	
	/**
	 * @author eliasku
	 */
	public class ShopGroupData
	{
		private var _id:String;
		private var _title:String;
		private var _items:Vector.<String> = new Vector.<String>();
		
		public function ShopGroupData()
		{
		}
		
		public function parse(xml:XML):void
		{
			var node:XML;
			var item:String;
			
			if (xml)
			{
				if (xml.hasOwnProperty("@id"))
					_id = xml.@id;
				if (xml.hasOwnProperty("@title"))
					_title = StringManager.localize(xml.@title);
				
				for each (node in xml.item)
				{
					if (node.hasOwnProperty("@name"))
					{
						item = node.@name;
						
						if (AppData.hasItem(item))
							_items.push(item);
					}
				}
			}
		}
		
		public function get id():String
		{
			return _id;
		}
		
		public function get items():Vector.<String>
		{
			return _items;
		}
		
		public function get title():String
		{
			return _title;
		}
	}
}
